/*package com.qst.medical.controller.login;*/

import com.qst.medical.domain.Account;
import com.qst.medical.service.login.LoginorOutService;
import com.qst.medical.util.JwtUtils;
import com.qst.medical.util.Msg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 登录、登出控制器 LoginController
 *
 * @author liulindong
 * @since 2021年8月17日13:51:08
 */

/*
@Api(tags = "登录控制器")
@RestController
@RequestMapping("/api/user")
@CrossOrigin
public class LoginController {

    @Autowired
    private LoginorOutService loginorOutService;

    */
/**
     * 登录接口
     * @return
     *//*

    @ApiOperation("登录接口")
    @PostMapping("/login")
    public Msg login(String uname, String pwd) {
        Account account = loginorOutService.login(uname, pwd);//查数据库
        if (account != null) {
            account.setPwd("");//密码设为空
            String token = JwtUtils.getJwtToken(account.getId().toString(), uname);//生成token
            return Msg.success().data("loginedUser",account).data("token",token);//响应数据
        }
        return Msg.fail().mess("登录失败");
    }
}*/
